qinglan.Canvas.FPS = qinglan.Canvas.Font.extend(function(id, position,opt){
	this.msg = '0 FPS';
	this.position = new qinglan.Canvas.Vector2(20, 20);

	this.lastTotalFrames = -1;
	this.lastTime = -1;
}).methods({
	initData: function() {
		this.lastTime = (new Date()).getTime();
		this.lastTotalFrames = qinglan.Canvas.World.frames;
	},
	update: function(ctx) {
		(-1 == this.lastTime) && this.initData(); 
		this.supr(ctx);
		var nowTime = (new Date()).getTime();
		if(1000 < (nowTime - this.lastTime)){
			this.msg = (qinglan.Canvas.World.frames - this.lastTotalFrames) + ' FPS';
			this.initData();
		}
	},
	draw: function(ctx) {
		this.supr(ctx);
	},
	distory: function(){
		this.supr(ctx);
	}
});
